package com.hp.ecs.xqa.util.orm;

import org.hibernate.cfg.DefaultNamingStrategy;
import org.hibernate.util.StringHelper;
import org.springframework.stereotype.Component;

@Component
public class LocalNamingStrategy extends DefaultNamingStrategy {

	private static final long serialVersionUID = 5967267053375534546L;

	public String classToTableName(String className) {
		return StringHelper.unqualify(className + "_t");
	}

	public String propertyToColumnName(String propertyName) {
		return StringHelper.unqualify(propertyName + "_f");
	}

	/**
	 * Return the property name or propertyTableName
	 */
	public String foreignKeyColumnName(String propertyName, String propertyEntityName,
			String propertyTableName, String referencedColumnName) {
		return StringHelper.unqualify(propertyName + "_f");
	}
}
